<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Execute the query.</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongocursor.dead.html">MongoCursor::dead</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongocursor.explain.html">MongoCursor::explain</a></div>
 <div class="up"><a href="class.mongocursor.html">MongoCursor</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mongocursor.doquery" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoCursor::doQuery</h1>
  <p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">MongoCursor::doQuery</span> &mdash; <span class="dc-title">Execute the query.</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-mongocursor.doquery-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">protected</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>MongoCursor::doQuery</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <div class="warning"><strong class="warning">Warning</strong>
   <p class="para">
    Please do not use me.
   </p>
  </div>
  <p class="para">
   This function actually queries the database.  All queries and commands go 
   through this function.  Thus, this function can be overridden to provide 
   custom query handling.  
  </p>
  <p class="para">
   This handles serializing your query, sending it to the database, receiving a 
   response, and deserializing it.  Thus, if you are planning to override this,
   your code should probably call out to the original to use the existing
   functionality (see the example below).
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-mongocursor.doquery-parameters">
  <h3 class="title">参数</h3>    
  <p class="para">此函数没有参数。</p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-mongocursor.doquery-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   <strong><code>NULL</code></strong>.
  </p>
 </div>

 
 <div class="refsect1 errors" id="refsect1-mongocursor.doquery-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   Throws <a href="class.mongoconnectionexception.html" class="classname">MongoConnectionException</a> if it cannot reach the 
   database.
  </p>
 </div>

 
 <div class="refsect1 changelog" id="refsect1-mongocursor.doquery-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>1.2.11</td>
       <td>Emits <strong><code>E_DEPRECATED</code></strong> when used.</td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mongocursor.doquery-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="mongocursor.doquery.example.basic">
    <p><strong>Example #1 <span class="function"><strong>MongoCursor::doQuery()</strong></span> example</strong></p>
    <div class="example-contents"><p>
     You could override this function to attempt a query on a secondary and, if
     that fails, try it again on the primary.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">MyCursor&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">MongoCursor&nbsp;</span><span style="color: #007700">{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;function&nbsp;</span><span style="color: #0000BB">doQuery</span><span style="color: #007700">()&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">slaveOkay</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">MongoCursor</span><span style="color: #007700">::</span><span style="color: #0000BB">doQuery</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;catch(</span><span style="color: #0000BB">MongoCursorException&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">slaveOkay</span><span style="color: #007700">(</span><span style="color: #0000BB">false</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">MongoCursor</span><span style="color: #007700">::</span><span style="color: #0000BB">doQuery</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>
 
</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongocursor.dead.html">MongoCursor::dead</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongocursor.explain.html">MongoCursor::explain</a></div>
 <div class="up"><a href="class.mongocursor.html">MongoCursor</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
